1 安装debian12
2 安装LinuxCNC https://linuxcnc.org/docs/stable/html/getting-started/getting-linuxcnc.html#_installing_on_debian_bookworm_with_preempt_rt_kernel
    sudo apt update
    sudo apt dist-upgrade
    sudo apt install linux-image-rt-amd64
    uname -v
    wget -O linuxcnc-install.sh https://www.linuxcnc.org/linuxcnc-install.sh
    chmod +x linuxcnc-install.sh
    sudo ./linuxcnc-install.sh

3 安装EtherCAT https://forum.linuxcnc.org/ethercat/45336-ethercat-installation-from-repositories-how-to-step-by-step
    sudo vi  /etc/apt/sources.list.d/science_EtherLab.list
        deb [arch=amd64,arm64 signed-by=/etc/apt/trusted.gpg.d/science_EtherLab.gpg.key.binary.gpg] http://download.opensuse.org/repositories/science:/EtherLab/Debian_12/ ./

    sudo vi /etc/apt/apt.conf.d/99disable-signature-verification
Acquire::AllowInsecureRepositories "true";
Acquire::AllowDowngradeToInsecureRepositories "true";
APT::Get::AllowUnauthenticated "true";

    sudo apt update
    sudo apt install linuxcnc-ethercat

    ip a
    sudo vi /etc/ethercat.conf
        MASTER0_DEVICE="xx:aa:yy:zz:bb:cc"
        DEVICE_MODULES="generic"

    sudo systemctl enable ethercat.service
    sudo systemctl start ethercat.service
    sudo systemctl status ethercat.service
    sudo chmod 666 /dev/EtherCAT0
    ethercat slaves

    sudo vi /etc/udev/rules.d/99-ethercat.rules
        KERNEL=="EtherCAT[0-9]", MODE="0777"
    sudo udevadm control --reload-rules
    重启